import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class TaskM extends Thread {
    public TaskM() {
        try {
            this.input = new BufferedReader(new FileReader("input.txt"));
            this.output = new PrintWriter("output.txt");
//            this.input = new BufferedReader(new InputStreamReader(System.in));
//            this.output = new PrintWriter(System.out);
            this.setPriority(Thread.MAX_PRIORITY);
        } catch (Exception e) {
            System.exit(666);
        }
    }

    private void solve() throws Throwable {
        int H = nextInt();
        int N = nextInt();
        int []heights = new int[N];
        int max = Integer.MIN_VALUE, ind = -1;
        for (int i = 0; i < N; ++i) {
            heights[i] = nextInt();
            if (heights[i] > max) {
                max = heights[i];
                ind = i;
            }
        }
        int []hists = new int[N];
        for (int i = 0; i < N; ++i) {
            hists[i] = H * heights[i] / max;
        }
        char [][]out = new char[H][N];
        for (char[] current : out) {
            Arrays.fill(current, ' ');
        }
        for (int i = 0; i < N; ++i) {
            for (int amount = 0; amount < hists[i]; ++amount) {
                out[H - 1 - amount][i] = '#';
            }
        }
        for (int i = 0; i < H; ++i) {
            for (int j = 0; j < N; ++j) {
                output.print(out[i][j]);
            }
            output.println();
        }


    }


    public void run() {
        try {
            solve();
        } catch (Throwable e) {
            System.err.println(e.getMessage());
            e.printStackTrace();
            System.exit(666);
        } finally {
            output.flush();
            output.close();
        }
    }

    public static void main(String[] args) {
        new TaskM().start();
    }

    private int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    private long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    private double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    private String nextToken() throws IOException {
        while (tokens == null || !tokens.hasMoreTokens()) {
            tokens = new StringTokenizer(input.readLine());
        }
        return tokens.nextToken();
    }
    private BufferedReader input;
    private PrintWriter output;
    private StringTokenizer tokens = null;
}